Add filter flags to branch list-tablets#1272
Merged
Merged
Conversation
`pscale branch list-tablets` returned every tablet on a branch, so finding a specific tablet alias (e.g. for a throttler config change) on large, multi-keyspace branches meant parsing the full output by hand. Add the filters that vtctldclient GetTablets supports, now that the API and SDK pass them through (planetscale/issues#1955): - --keyspace, --shard (requires --keyspace), --tablet-type - --tablet-alias (comma-separated/repeatable; overrides the other filters) Bumps planetscale-go to v0.168.0 for the new ListBranchTabletsRequest filter fields.
dgraham
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pscale branch list-tabletsreturned every tablet on a branch with no way to filter. On large, multi-keyspace branches, finding the specific tablet alias you need (e.g. for athrottlerconfigchange) meant parsing the full output by hand.Changes
Four optional flags on
branch list-tablets:--keyspace— only list tablets in this keyspace.--shard— only list tablets in this shard (requires--keyspace, matching vitess semantics).--tablet-type— only list tablets of this type (e.g.primary,replica,rdonly).--tablet-alias— only list the tablet(s) with these aliases (comma-separated / repeatable). When set, the other filters are ignored.With no flags the behavior is unchanged. Validation of the filter combinations (e.g. shard without keyspace, unknown tablet type) is handled server-side and surfaced via the normal error path. Bumps
planetscale-gotov0.168.0for the newListBranchTabletsRequestfilter fields.Rendered help:
Testing
Added
list_tablets_test.go: one case asserting an unfiltered call sends empty filters, and one asserting all four flags (including comma-separated--tablet-alias) are forwarded to the SDK request.go build,go vet,gofmt, and thevtctldpackage tests pass locally; verified the--helpoutput renders the flags as shown above.